package top.saodisheng.springcloud.service;

import org.springframework.cloud.openfeign.FallbackFactory;
import top.saodisheng.springcloud.pojo.Dept;

import java.util.List;

/**
 * Description:
 *
 * @author 扫地生_saodisheng
 */
public class DeptClientServiceFallBackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable cause) {
        return new DeptClientService() {
            @Override
            public List<Dept> queryAll() {
                return null;
            }

            @Override
            public Dept queryById(Long id) {
                return new Dept()
                        .setDeptid(id)
                        .setDeptname("id => " + id + "没有对应信息，客户端提供了降级的信息，这个服务现在已经关闭")
                        .setDb_source("没有数据~");
            }

            @Override
            public boolean addDept(Dept dept) {
                return false;
            }
        };
    }
}
